# utils/request_util.py
import requests
from configparser import ConfigParser

config = ConfigParser()
config.read('config/config.ini', encoding='utf-8')


def send_905_protocol(data):
    """905协议请求函数（必须与导入名称完全一致）"""
    url = config.get('protocol', 'base_url')
    headers = {"Content-Type": "application/json"}

    try:
        response = requests.post(
            url,
            json=data,
            headers=headers,
            timeout=5
        )
        response.raise_for_status()
        return response
    except Exception as e:
        print(f"请求异常：{str(e)}")
        raise